package com.taotao.decorate;

import com.taotao.entity.UserEntity;
import com.taotao.utils.JvmMapCacheUtils;
import org.springframework.stereotype.Component;

/**
 * @Author: wangjin
 * @CreateTime: 2022-06-21  22:57
 */
@Component
public class JvmComponentCache  implements ComponentCache{
    @Override
    public <T> T getCache(String key,Integer id) {
        //1，一级缓存，从jvm中查询到数据
        UserEntity userEntity= JvmMapCacheUtils.getEntity(key,UserEntity.class);
        return (T) userEntity;
    }
}
